<?php echo $this->Html->link('Upload a file', array('controller' => 'items', 'action' => 'add_file', $user_logged['id']))?>
<table>
	<tr>
	<td colspan="7" style="text-align: center">My own files</td>
	</tr>
	<tr>
		<th>File name</th>
		<th>Date added</th>
		<th>Size (MB)</th>
		<th>Type</th>
		<th>Download</th>
		<th>Choose with who you share</th>
		<th>Delete</th>
	</tr>
	<?php foreach ($own_files as $own_file): ?>
	<tr>
		<td><?php echo $own_file['items']['file_name']; ?></td>
		<td><?php echo $own_file['items']['created']; ?></td>
		<td><?php echo round($own_file['items']['size']/1024/1024,2); ?></td>
		<td><?php echo $own_file['items']['type']; ?></td>
		<td><?php echo $this->Html->link('Download', array('action' => 'download', $own_file['items']['id_file']))?></td>
		<td><?php echo $this->Html->link('Edit Sharing', array('action' => 'Edit', $own_file['items']['id_file']))?></td>
		<td style="text-align: center"><?php echo $this -> Form -> postLink($this -> Html -> image("admin/delete.gif", array("alt" => "delete")), array('action' => 'delete', $own_file['items']['id_file']), array('escape' => false, 'confirm' => 'Are you sure?')); ?></td>
	</tr>
	<?php endforeach; ?>
</table>

<br/><br/><br/>

<table>
	<tr>
		<td colspan="5" style="text-align: center">Files shared with me</td>
	</tr>
	<tr>
		<th>File name</th>
		<th>Shared by</th>
		<th>Date added</th>
		<th>Size (MB)</th>
		<th>Type</th>
		<th>Download</th>
	</tr>
	<?php foreach ($single_files as $single_file): ?>
	<tr>
		<td><?php echo $single_file['items']['file_name']; ?></td>
		<td><?php echo $single_file['users']['name']; ?></td>
		<td><?php echo $single_file['items']['created']; ?></td>
		<td><?php echo round($single_file['items']['size']/1024/1024,2); ?></td>
		<td><?php echo $single_file['items']['type']; ?></td>
		<td><?php echo $this->Html->link('Download', array('action' => 'download', $single_file['items']['id_file']))?></td>
	</tr>
	<?php endforeach; ?>
</table>
<br/> <br/> <br />	
<table>
	<tr>
		<td colspan="5" style="text-align: center">Files shared with groups in which I'm a member</td>
	</tr>
	<tr>
		<th>File name</th>
		<th>Shared within</th>
		<th>Date added</th>
		<th>Size (MB)</th>
		<th>Type</th>
		<th>Download</th>
	</tr>
	<?php foreach ($groups_files as $group_file): ?>
	<tr>
		<td><?php echo $group_file['items']['file_name']; ?></td>
		<td><?php echo $group_file['groups']['group_name']; ?></td>
		<td><?php echo $group_file['items']['created']; ?></td>
		<td><?php echo round($group_file['items']['size']/1024/1024,2); ?></td>
		<td><?php echo $group_file['items']['type']; ?></td>
		<td><?php echo $this->Html->link('Download', array('action' => 'download', $group_file['items']['id_file']))?></td>
	</tr>
	<?php endforeach; ?>
</table>
